import { Component, Input, OnInit } from '@angular/core';
import { Store } from '@ngxs/store';
import { BookAction } from '../../../store/book';

@Component({
  selector: 'app-list-card',
  templateUrl: './list-card.component.html',
  styleUrls: ['./list-card.component.scss'],
})
export class ListCardComponent implements OnInit {
  @Input('item') item!: any;

  constructor(
      private store: Store,
  ) {
  }

  ngOnInit(): void {
  }

  collect() {
    this.store.dispatch(new BookAction.Collect(this.item));
  }

  edit() {
    this.store.dispatch(new BookAction.Edit(this.item));
  }

}
